package com.telecom.restaurant.constant;

import com.telecom.restaurant.domin.DataResult;

/**
 * Created by qiqi on 2019/11/23.
 */
public class DataResultConstant {

    public static DataResult SUCCESS = new DataResult(0, "success");

    public static DataResult WRONG_PARAM = new DataResult(101, "参数错误");
    public static DataResult WRONG_PASSWORD = new DataResult(201, "用户名或密码错误");
    public static DataResult WRONG_TOKEN = new DataResult(202, "登录已过期，请重新登录");

    public static DataResult SAME_FOOD_NAME = new DataResult(1101, "菜品名称重复");

    public static DataResult DATA_ERROR = new DataResult(505, "内部数据错误");
    public static DataResult NO_PERMISSION = new DataResult(510, "权限不足");


    public static DataResult WX_ERROR = new DataResult(601, "微信错误");


    public static DataResult WRONG_ORDER_TIME = new DataResult(801, "非下单时间");
    public static DataResult CART_IS_EMPTY = new DataResult(802, "购物车为空");
    public static DataResult CHOOSE_FOOD_WRONG = new DataResult(803, "菜品选择错误");
    public static DataResult FOOD_STOCK_NOT_ENOUGH = new DataResult(804, "菜品库存不足");
    public static DataResult WRONG_MENU_DATA = new DataResult(805, "菜单数据错误");
    public static DataResult DINNER_ONLY = new DataResult(806, "外卖只能点晚餐");
    public static DataResult DISH_TYPE_WRONG = new DataResult(807, "菜品类型错误");
    public static DataResult PACKAGE_FOOD_COUNT_ERROR = new DataResult(808, "套餐菜品数量错误");
    public static DataResult COUPON_USED = new DataResult(809, "当天的优惠券已经使用");

    public static DataResult ORDER_ID_NOT_EXIST = new DataResult(820, "订单号不存在");
    public static DataResult ORDER_STATUS_CANT_CANCEL = new DataResult(821, "当前订单状态不能取消");

    public static DataResult buildSuccessResult(Object data) {

        DataResult dataResult = new DataResult();
        dataResult.setCode(0);
        dataResult.setMsg("success");
        dataResult.setData(data);
        return dataResult;
    }
}
